@extends('admin.master')

@section('style')
   <link rel="stylesheet" href="{{ url('js/prettyphoto/css/prettyPhoto.css') }}">
@endsection

@section('top')
	<div class="top-breadcrumb pull-left">{!! Breadcrumbs::render() !!}</div>
@endsection

@section('content')
	<div class="container-body">
	{!! Form::model($data, ['route' => ['admin.contract.update', $data->id], 'method'=>'patch', 'class'=>'form-horizontal']) !!}
		<div class="form-group">
			<label class="col-sm-4 control-label label-width"><span>客户名称：</span></label>
			<div class="col-sm-6 row">
			@if ($data->cid)
				<p class="form-control-static"><strong class="text-success">{{ $data->customer->name }}</strong></p>
			@else 
				<p class="form-control-static"><strong class="text-warning">未绑定具体客户</strong></p>
			@endif
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-4 control-label label-width">合同号：</label>
			<div class="col-sm-8 row">
				{!! Form::text('contract_no', null, ['class'=>'form-control len', 'disabled']) !!}
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-4 control-label label-width">合同内容：</label>
			<div class="col-sm-8 row">
				<div id="fileupload" class="upload-sm">
					<a id="pickfile" data-type=1 data-name="contract[]" data-marks="contracts" class="btn btn-default btn-sm upload" href="javascript:;">上传合同</a>
				</div>
				<div class="attachments attachments-contract clearfix">
				@if ($data->contract && is_array($data->contract))
				@foreach ($data->contract as $value)
					<div class="thumbnail">
						<input type="hidden" name="contract[]" value="{{ $value }}">
						<a class="thumbnail-img" href="{{ url($value) }}" rel="prettyPhoto[contracts]">
							<img src="{{ thumbFull($value, 80) }}">
						</a>
						<a href="javascript:;" class="thumbnail-remove">删除</a>
					</div>
				@endforeach
				@endif
				</div>
				<div class="upload-message"></div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-4 control-label label-width">发票回执：</label>
			<div class="col-sm-8 row">
				<div id="fileupload2" class="upload-sm">
					<a id="pickfile2" data-type=1 data-name="invoice_receipt[]" data-marks="receipts" class="btn btn-default btn-sm upload" href="javascript:;">上传发票回执</a>
				</div>
				<div class="attachments attachments-invoice-receipt clearfix">
				@if ($data->invoice_receipt && is_array($data->invoice_receipt))
					@foreach ($data->invoice_receipt as $value)
						<div class="thumbnail">
							<input type="hidden" name="invoice_receipt[]" value="{{ $value }}">
							<a class="thumbnail-img" href="{{ url($value) }}" rel="prettyPhoto[receipts]">
								<img src="{{ thumbFull($value, 80) }}">
							</a>
							<a href="javascript:;" class="thumbnail-remove">删除</a>
						</div>
					@endforeach
				@endif
				</div>
				<div class="upload-message"></div>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-4 control-label label-width">发票类型：</label>
			<div class="col-sm-8 row">
				<label class="radio-inline">
					{!! Form::radio('invoice_type', 1, true) !!} 普票
				</label>
				<label class="radio-inline">
					{!! Form::radio('invoice_type', 2) !!} 增票
				</label>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-4 control-label label-width">发票状态：</label>
			<div class="col-sm-8 row">
				<label class="checkbox-inline">
					{!! Form::checkbox('invoice_status', 1, null) !!} 发票已开
				</label>
				<label class="checkbox-inline">
					{!! Form::checkbox('invoice_receipt_status', 1, null) !!} 发票回执已收
				</label>
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-4 control-label label-width">备注：</label>
			<div class="col-sm-8 row">
				{!! Form::textarea('remark', null, ['class'=>'form-control len', 'rows'=>5]) !!}
			</div>
		</div>
		<div class="form-group">
			<label class="col-sm-4 control-label label-width"></label>
			<div class="col-sm-8 row">
				{!! Form::submit('提交', ['class'=>'btn btn-primary btn-submit']) !!}
			</div>
		</div>
	{!! Form::close() !!}
	</div>
@endsection

@section('foot')
<script src="{{ url('js/upload/plupload.full.min.js') }}"></script>
<script src="{{ url('js/fileupload.js') }}"></script>
<script src="{{ url('js/prettyphoto/jquery.prettyPhoto.js') }}"></script>

<script type="text/javascript">

$(function() {
	$("a[rel^='prettyPhoto']").prettyPhoto({social_tools: ''});
});

uploader({
	thumb: '80x80'
});
uploader({
	browse_button: 'pickfile2',
	thumb: '80x80',
	container: document.getElementById('fileupload2')
});  
</script>	
@endsection